<{include file="public/header.html"}>
		<div class="xinsu-section">
			<div class="xinsu-cross">
				<ul class="xinsu-cross-title">
					<li <{if $common_info.action == 'index'}>class="xinsu-current"<{/if}>><a href="/stock">持仓单</a></li>
					<li <{if $common_info.action == 'trust'}>class="xinsu-current"<{/if}>><a href="/stock/trust">委托单</a></li>
					<li <{if $common_info.action == 'delivery'}>class="xinsu-current"<{/if}>><a href="/stock/delivery">交割单</a></li>
					<div class="xinsu-clear"></div>
				</ul>
				<div class="xinsu-cross-con" id="xinsu-stock-list">
					<div class="xinsu-cross-search">
						<form class="xinsu-form" method="get">
							<input id="begin_time" class="xinsu-input" type="text" readonly name="begin_time" placeholder="开始日期" data-lcalendar="2011-01-1,<{date('Y-m-d')}>" value="<{if 0 != $begin_time}><{$begin_time}><{/if}>"/>
							<span>--</span>
							<input id="end_time"  class="xinsu-input01" type="text" readonly name="end_time" placeholder="结束日期" data-lcalendar="2011-01-1,<{date('Y-m-d')}>" value="<{if 0 != $begin_time}><{$end_time}><{/if}>"/>
							<button class="xinsu-btn">查询</button>
						</form>
					</div>
					
					<{if empty($list) == false}>
					<{foreach $list as $val}>
					<div class="xinsu-cross-list">
						<div class="xinsu-cross-list01">
							<div class="xinsu-cross-list-number">
								<p>编号：<{$val.id}></p>
							</div>
							<div class="xinsu-cross-list-time">
								<p>建仓时间：<{date("Y-m-d H:i:s", $val["bull_time"])}></p>
								<p>平仓时间：<{date("Y-m-d H:i:s", $val["sell_time"])}></p>
							</div>
							<div class="xinsu-clear"></div>
						</div>
						<div class="xinsu-cross-list02">
							<div>
								<p>股票名称：<{$val.stock_name}></p>
								<p>数量：<{$val.sell_num}>丨<{if $val.sell_type == 1}><span class="xinsu-color-red">融资↑</span><{else}><span class="xinsu-color-green">融券↓</span><{/if}></p>
								<div class="xinsu-clear"></div>
							</div>
							<ul>
								<li>
									<i>入价</i>
									<span class="xinsu-color-red"><{$val.bull_price}></span>
								</li>
								<li>
									<i>出价</i>
									<span class="xinsu-color-green"><{$val.sell_price}></span>
								</li>
								<li>
									<i>盈亏</i>
									<{if $val.total_gain > 0}>
									<span class="xinsu-color-red"><{$val.total_gain}></span>
									<{else}>
									<span class="xinsu-color-green"><{$val.total_gain}></span>
									<{/if}>
								</li>
								<div class="xinsu-clear"></div>
							</ul>
							<div class="xinsu-clear"></div>
						</div>
						<div class="xinsu-cross-list03">
							<p>手续费：-<{$val.cost}></p>
							<p>留仓天/费：-<{$val.save_money}>/<{$val.save_day}>天</p>
							<div class="xinsu-clear"></div>
						</div>
						<div class="xinsu-cross-list03">
							<p>管理费：-<{$val.manage_money}></p>
							<p>印花税：-<{$val.stamp_money}></p>
							<div class="xinsu-clear"></div>
						</div>
					</div>
					<{/foreach}>
					<{/if}>
				</div>
			</div>
		</div>
		<link rel="stylesheet" href="<{STATIC_SERVER}>/mobile/css/lCalendar.css" />
		<script src="<{STATIC_SERVER}>/mobile/js/lCalendar.js"></script>
		
		<script>
			<{if $common_info.action == 'delivery'}>
			//日期选择控件
			var calendar = new lCalendar();
			calendar.init({
				'trigger': '#begin_time',
				'type': 'date'
			});
			//日期选择控件
			var calendar = new lCalendar();
			calendar.init({
				'trigger': '#end_time',
				'type': 'date'
			});
			var url = "/stock/<{$common_info.action}>/<{$begin_time}>/<{$end_time}>/";
			<{else}>
			var url = "/stock/<{$common_info.action}>/";
			<{/if}>
			//自动加载
			var p = 2;
			var tmp = 0;
			
			$(window).scroll(function() {
				var scrollTop = $(this).scrollTop();
				var scrollHeight = $(document).height();
				var windowHeight = $(this).height();
				if (scrollTop + windowHeight == scrollHeight) {
					if (tmp != p) {
						//防止重复执行
						tmp = p;
						http_request_post(url + p, {}, function(result){
							if (result.status == 1 && result.data != "") {
								var html = "";
								$.each(result.data, function(key, val){	
									//股票类型
									if (val.sell_type == 1) {
										var bull_type = '<span class="xinsu-color-red">融资↑</span>';
									} else {
										var bull_type = '<span class="xinsu-color-green">融券↓</span>';
									}
									
									//盈亏
									if (val.total_gain > 0) {
										var total_gain = '<span class="xinsu-color-red">'+val.total_gain+'</span>';
									} else {
										var total_gain = '<span class="xinsu-color-green">'+val.total_gain+'</span>';
									}
									
									html += '<div class="xinsu-cross-list"><div class="xinsu-cross-list01"><div class="xinsu-cross-list-number"><p>编号：'+val.id+'</p></div><div class="xinsu-cross-list-time"><p>建仓时间：'+val.b_time+'</p><p>平仓时间：'+val.s_time+'</p></div><div class="xinsu-clear"></div></div><div class="xinsu-cross-list02"><div>	<p>股票名称：'+val.stock_name+'</p>	<p>数量：'+val.sell_num+'丨'+bull_type+'</p><div class="xinsu-clear"></div></div><ul><li><i>入价</i><span class="xinsu-color-red">'+val.bull_price+'</span>	</li><li><i>出价</i><span class="xinsu-color-green">'+val.sell_price+'</span></li><li><i>盈亏</i>'+total_gain+'</li><div class="xinsu-clear"></div></ul><div class="xinsu-clear"></div></div><div class="xinsu-cross-list03"><p>手续费：-'+val.cost+'</p><p>留仓天/费：-'+val.save_money+'/'+val.save_day+'天</p><div class="xinsu-clear"></div></div><div class="xinsu-cross-list03"><p>管理费：-'+val.manage_money+'</p><p>印花税：-'+val.stamp_money+'</p><div class="xinsu-clear"></div></div></div>';
								})
								$("#xinsu-stock-list").append(html);
								p ++;
							}
						});
					}
				}
			});
			
		</script>
		
<{include file="public/footer.html"}>